package com.changy.ai_tutor_for_dm.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import com.changy.ai_tutor_for_dm.interceptor.TokenInterceptor;

/**
 * 配置拦截器
 */
@Configuration
public class JwtTokenConfig implements WebMvcConfigurer {

    @Autowired
    private TokenInterceptor tokenInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(tokenInterceptor)
                // 拦截所有路径
                .addPathPatterns("/**");
    }
}